<?php

/**
 * Reservation filter form base class.
 *
 * @package    tfe
 * @subpackage filter
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedInheritanceTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseReservationFormFilter extends InscriptionFormFilter
{
  protected function setupInheritance()
  {
    parent::setupInheritance();

    $this->widgetSchema   ['id_evenement'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Evenement'), 'add_empty' => true));
    $this->validatorSchema['id_evenement'] = new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Evenement'), 'column' => 'id'));

    $this->widgetSchema   ['nb_pers'] = new sfWidgetFormFilterInput(array('with_empty' => false));
    $this->validatorSchema['nb_pers'] = new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false)));

    $this->widgetSchema   ['reduction'] = new sfWidgetFormFilterInput();
    $this->validatorSchema['reduction'] = new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false)));

    $this->widgetSchema   ['a_envoyer'] = new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no')));
    $this->validatorSchema['a_envoyer'] = new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)));

    $this->widgetSchema   ['envoyee'] = new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no')));
    $this->validatorSchema['envoyee'] = new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)));

    $this->widgetSchema->setNameFormat('reservation_filters[%s]');
  }

  public function getModelName()
  {
    return 'Reservation';
  }

  public function getFields()
  {
    return array_merge(parent::getFields(), array(
      'id_evenement' => 'ForeignKey',
      'nb_pers' => 'Number',
      'reduction' => 'Number',
      'a_envoyer' => 'Boolean',
      'envoyee' => 'Boolean',
    ));
  }
}
